
# coding: utf-8

# In[1]:

import pandas as pd


# In[5]:

import numpy as np


# In[6]:

s = pd.Series([1,3,5,np.nan,6,8])


# In[7]:

s


# In[8]:

dates = pd.date_range('20130101', periods=6)


# In[9]:

dates 


# In[10]:

dates = pd.date_range('20130101', periods=90)


# In[11]:

dates


# In[12]:

dates = pd.date_range('20130101', periods=6)


# In[13]:

df = pd.DataFrame(np.random.randn(6,4), index=dates, columns=list('ABCD'))


# In[14]:

df


# In[15]:

df = pd.DataFrame(np.random.randn(6,4), index=dates, columns=list('ABCD', "DEFG", "HIJK", "LMNO"))


# In[16]:

df = pd.DataFrame(np.random.randn(6,4), index=dates, columns=['ABCD', "DEFG", "HIJK", "LMNO"])


# In[17]:

df


# In[21]:

df2 = pd.DataFrame({"A":1, "B":pd.Timestamp('20161207'),
                   "C":pd.Series(1, index=list(range(4)), dtype='int64'),
                   "D":np.array([3]*4, dtype="int32"),
                   "E":pd.Categorical(["test","Train","Test","Train"]),"F":"FOO"})


# In[22]:

df2


# In[23]:

df2.dtypes


# In[24]:

df.head()


# In[25]:

df.tail()


# In[26]:

df2.index


# In[27]:

df2


# In[28]:

df2.columns


# In[29]:

df2.index


# In[30]:

df2.values


# In[31]:

df.describe()


# In[32]:

df.T


# In[33]:

df


# In[34]:

df.sort_index(axis=1, ascending=False)


# In[35]:

df


# In[36]:

df.sort_index(axis=0, ascending=False)


# In[37]:

df.sort_values(by="DEFG", ascending=False)


# In[38]:

df.ABCD


# In[39]:

df.DEFG


# In[40]:

df["ABCD"]


# In[41]:

df


# In[42]:

df[0:3]


# In[43]:

df[1:3]


# In[44]:

df[1:-1]


# In[46]:

df[1:1]


# In[47]:

df[1:2]


# In[48]:

df


# In[49]:

df["2013-01-02":"2013-01-05"]


# In[50]:

df.loc[dates[0]]


# In[51]:

df


# In[52]:

df[:]


# In[54]:

df.loc[:, ["ABCD", "HIJK"]]


# In[55]:

df.loc['20130102':'20130104',['ABCD','LMNO']]


# In[56]:

df.loc[dates[0],'ABCD']


# In[57]:

df.iloc[3]


# In[58]:

type(df.iloc[3])


# In[59]:

df.iloc[3].to_dict()


# In[61]:

type(df.iloc[3].to_dict())


# In[62]:

df.iloc[[1,2,4],[0,2]]


# In[63]:

df


# In[65]:

df.iloc[1:3, :]


# In[66]:

df


# In[67]:

df


# In[68]:

df.iloc[:, 1,3]


# In[69]:

df


# In[70]:

df.iloc[:, 1:3]


# In[71]:

df.iloc[:, 1:3]


# In[72]:

df.iloc[1:1]


# In[73]:

df


# In[74]:

dr = df[df['ABCD']>0]


# In[75]:

dr


# In[76]:

df[df>0]


# In[77]:

df


# In[ ]:



